package com.jason.kotlinstudy

import android.graphics.Bitmap
import android.os.Bundle
import android.util.Log
import android.widget.ImageView
import androidx.appcompat.app.AppCompatActivity
import com.jason.kotlinstudy.bean.BitmapBinder

/**
 *
 */
class SecondActivity : AppCompatActivity() {

    private lateinit var bitmap: Bitmap
    private val TAG = this.localClassName

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_second)

        val bundle = intent.extras
        val bitmapBinder = bundle!!.getBinder("bitmap") as BitmapBinder?
        bitmap = bitmapBinder!!.bitmap
        bitmap?.let {
            Log.i(TAG, "Mani2Activity bitmap 大小" + bitmap.getByteCount() / 1024 + " kb")
            Log.i(TAG, "Mani2Activity bitmap 大小" + bitmap.getByteCount() / (1024*1024) + " mb")
            findViewById<ImageView>(R.id.iv_image).setImageBitmap(bitmap)
        }
    }
}